﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using LocalizedResources;


namespace ConsoleDemo
{
    public class Person:IValidatableObject  
    {
        [Display(Name=DisplayNames.Keys.FirstName)]
        [Required(ErrorMessageResourceName=ErrorMessages.Keys.RequiredMessage)]
        public string FirstName { get; set; }

        [Display(Name = DisplayNames.Keys.LastName)]
        [Required]
        public string LastName { get; set; }

        [Display(Name = DisplayNames.Keys.Phone)]
        public string Phone { get; set; }

        [Display(Name = DisplayNames.Keys.Address)]
        [MaxLength(30)]
        public string Address { get; set; }

        #region IValidatableObject Members

        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield return new ValidationResult(ErrorMessages.CustomModelError);
        }

        #endregion
    }
}